<?php
namespace app\home\controller;
use PHPUnit\Framework\TestCase;

class Curlrequesttest extends TestCase
{


    public function testCurlRequest()
    {
        
        // 测试正常请求
        $url = 'https://106.ihuyi.com/webservice/sms.php?method=Submit&account=C90800916&password=1b5edacb8f8a4ec7ec7798ab24cd3a06&format=json';
        $post = true;
        $params =    $params = [
            'mobile' => $phone,
            'content' => $content,
        ];
        $https = true;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);

        // 测试非 POST 请求
        $post = false;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);

        // 测试非 HTTPS 请求
        $https = false;

        $result = curl_request($url, $post, $params, $https);

        $this->assertNotNull($result);
    }
}
